#ifndef _USERDRIVER_H_
#define _USERDRIVER_H_

#include "sys.h"



#define CBH_MAX_PWM 55
#define DRIVER_MAX_SPEED_PWM  30


typedef struct{
  float Kp;
  float Ki;
  float Kd;
  
  float ansISum;
  float ansIMAX;
  int errIMAX;
  int lastError;
  int target;
  float ansAll;
} PARAMTER_PID;

typedef struct{
  float Kp;
  float Ki;
  float Kd;
  
  float ansISum;
  float ansIMAX;
  int errIMAX;
  int lastError;
} PARAMTER_CBH;

extern PARAMTER_PID pidL;
extern PARAMTER_PID pidR;
extern PARAMTER_CBH cbh;

void DRIVER_PID(PARAMTER_PID* pid, int presentState, float* pwm);
void DRIVER_CBH(int presentState);


#endif








